﻿namespace com.stifel.BranchMgmt.WebParts.Search
{
    using System;
    using System.ComponentModel;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;

    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;
    using Microsoft.SharePoint.WebControls;

    [ToolboxItemAttribute( false )]
    public class Search : WebPart
    {
        #region Fields

        // Visual Studio might automatically update this path when you change the Visual Web Part project item.
        private const string _ascxPath = @"~/_CONTROLTEMPLATES/com.stifel.BranchMgmt.WebParts/Search/SearchUserControl.ascx";

        #endregion Fields

        #region Properties

        [Personalizable( PersonalizationScope.Shared )]
        [DefaultValue( "~" )]
        [WebBrowsable( true )]
        [WebDisplayName( "Target Page" )]
        [WebDescription( "Specifies the target page where the branch information is displayed." )]
        [Microsoft.SharePoint.WebPartPages.SPWebCategoryName( "Miscellaneous" )]
        public string TargetPage
        {
            get;
            set;
        }

        #endregion Properties

        #region Methods

        protected override void CreateChildControls( )
        {
            SearchUserControl suControl = ( SearchUserControl ) Page.LoadControl( _ascxPath );
            suControl.TargetPage = this.TargetPage;
            Controls.Add( suControl );
        }

        #endregion Methods
    }
}